<template>
<div class="supervision_pag">
    <!--面包屑-->
    <Breadcrumb :Breadcrumb="Breadcrumb"></Breadcrumb>
    <div class="contentBox">
        <div class="archiveslist-box">
            <h1 class="Basics-title">
                <h2>档案列表</h2>
            </h1>
            <!-- 第一行操作区域-->
            <div class="archiveslist-table">
                <div class="choise-row-left">
                    <span class="label">档案名称：</span>
                    <el-input v-model="name" placeholder="请输入"></el-input>
                    <span class="label">年份：</span>
                    <el-date-picker value-format="yyyy" v-model="year" type="year" placeholder="选择年份" :clearable="false"></el-date-picker>
                    <el-row>
                        <el-button type="query" @click="Getlist">查询</el-button>
                        <el-button type="Reset" @click="GetBack">重置</el-button>
                    </el-row>
                </div>
            </div>
            <!--表格区域-->
            <div class="table-box-three-main">
                <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" border>
                    <el-table-column type="index" label="序号" width="51" align="center"></el-table-column>
                    <el-table-column prop="year" label="年份" width="100" align="center"></el-table-column>
                    <el-table-column prop="name" label="档案名称" min-width="400"></el-table-column>
                    <el-table-column prop="updateTime" label="最后修改日期" width="305" align="center"></el-table-column>
                    <el-table-column label="操作" width="197" align="center">
                        <template slot-scope="scope">
                            <el-button type="text" @click="archiveLook">查看</el-button>
                            <!--编辑页面-->
                            <el-button type="text" class="edit" @click="archiveEdit">编辑</el-button>
                            <!--删除弹窗-->
                            <el-popover placement="top" width="160" v-model="scope.row.istrue">
                                <p>是否要删除此行？</p>
                                <div style="text-align: right; margin: 0">
                                    <el-button size="mini" type="text" @click="scope.row.istrue = false">取消</el-button>
                                    <el-button type="primary" size="mini" @click="scope.row.istrue = false">确定</el-button>
                                </div>
                                <el-button type="text" slot="reference">删除</el-button>
                            </el-popover>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
            <!-- 分页开始 -->
            <Pagination :total="total" :params="parmans" :get="getSuperviseArchiveMore"></Pagination>
            <!-- 分页结束 -->
        </div>
    </div>
</div>
</template>

<script>
import Breadcrumb from "@/components/IncorruptibleArchives/Breadcrumb.vue";
// 分页器
import Pagination from "@/components/Popup/Pagination.vue";
export default {
    components: {
        Breadcrumb,
        Pagination,
    },
    data() {
        return {
            visible: true,
            total: 0,
            name: "",
            year: null,
            //面包靴跳转数据
            Breadcrumb: [{
                    name: "廉政档案",
                    link: "IncorruptibleArchives",
                },
                {
                    name: "监督对象",
                    link: "supervise",
                },
                {
                    name: "监督对象详情",
                    link: "supervisedetail",
                },
                {
                    name: "更多档案列表",
                    link: "",
                },
            ],
            tableData: [],
            parmans: {
                pageNum: 1,
                pageSize: 10,
                personId: this.$route.query.id,
                name: "",
            },
        };
    },
    created() {
        this.getSuperviseArchiveMore()
    },
    methods: {
        //获取监督对象列表更多
        getSuperviseArchiveMore() {
            this.Api.getSuperviseArchiveMore(this.parmans).then((res) => {
                // console.log(res, "获取监督对象列表更多")
                if (res.code === "0" && res) {
                    this.tableData = res.data.records
                    this.total = res.data.total
                }
            });
        },
        Getlist() {
            // console.log(this.year, 'this.year')
            this.parmans = {
                pageNum: 1,
                pageSize: 10,
                personId: this.$route.query.id,
                name: this.name,
                year: this.year
            }
            this.getSuperviseArchiveMore()
        },
        GetBack() {
            this.name = "";
            this.year = null;
            this.parmans = {
                pageNum: 1,
                pageSize: 10,
                personId: this.$route.query.id,
                name: this.name,
                year: this.year
            }
            this.getSuperviseArchiveMore()
        },
        //档案列表查看按钮触发，触发七种不同的查看页面
        archiveLook() {
            //监督对象
            //干部任免
            // this.$router.push({
            //     name: "ArchivesEdit",
            // });
            //干部述责述廉表
            // this.$router.push({
            //     name: "ResponsibilityAndIntegrity",
            // });
            //干部操办事宜报告表
            // this.$router.push({
            //     name: "OperationalMmatters",
            // });
            //处分情况登记表
            // this.$router.push({
            //     name: "PunishmentList",
            // });
            //礼品情况登记表
            // this.$router.push({
            //     name: "GiftRegistration",
            // });
            //离职交接表
            this.$router.push({
                name: "TurnoverForm",
            });
        },
        //档案列表编辑按钮触发，触发七种不同的编辑页面
        archiveEdit() {
            // 监督对象
            //干部任免
            // this.$router.push({
            //     name: "ArchivesEdit",
            // });
            //干部述责述廉表
            // this.$router.push({
            //     name: "ResponsibilityAndIntegrity",
            // });
            //干部操办事宜报告表
            // this.$router.push({
            //     name: "OperationalMmatters",
            // });
            //处分情况登记表
            // this.$router.push({
            //     name: "PunishmentList",
            // });
            //礼品情况登记表
            // this.$router.push({
            //     name: "GiftRegistration",
            // });
            //离职交接表
            this.$router.push({
                name: "TurnoverForm",
            });
        },
    },
};
</script>

<style lang="less" scoped>
.archiveslist-box {
    padding: 20px;
    background-color: white;

    //表头标签
    .Basics-title {
        padding: 0 0 20px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0;
        background-color: white;

        >h2 {
            font-size: 16px;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 600;
            color: rgba(51, 51, 51, 1);
            line-height: 16px;
            border-left: 4px solid #3d7fff;
            padding: 0 0 0 10px;
        }
    }

    /deep/.archiveslist-table {
        margin-bottom: 20px;

        .choise-row-left {
            display: flex;

            .label {
                font-size: 14px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: rgba(51, 51, 51, 1);
                line-height: 36px;
            }

            //输入框
            .el-input {
                width: 260px;

                background: rgba(255, 255, 255, 1);
                border-radius: 3px;
                margin-right: 20px;
                height: 36px;
            }

            .el-input__inner {
                height: 36px;
                padding-left: 10px;
            }

            .el-button--query {
                width: 52px;
                height: 36px;
                background: rgba(61, 127, 255, 1);
                border-radius: 3px;
                padding: 0;
                color: rgba(255, 255, 255, 1);
                font-size: 14px;
            }

            .el-button--Reset {
                width: 52px;
                height: 36px;
                background: rgba(240, 242, 245, 1);
                border-radius: 3px;
                border: 1px solid rgba(215, 219, 224, 1);
                padding: 0;
                color: rgba(51, 51, 51, 1);
                font-size: 14px;
            }

            .el-input__prefix {
                left: 230px;
            }
        }
    }
}

.edit {
    padding: 0 10px;
    border-left: 1px solid #dddddd;
    border-right: 1px solid #dddddd;
}

.el-popover__reference {
    margin-left: 10px;
}

.supervision_pag {
    width: 100%;
    height: 100%;
    overflow: hidden;

    .contentBox {
        width: 100%;
        height: calc(100% - 56px);
        overflow: auto;
    }
}
</style>
